"""
RagFlow 客户端 GUI 启动脚本
"""

import argparse
import sys

def check_pyside6():
    """检查PySide6是否可用"""
    try:
        import PySide6
        return True
    except ImportError:
        return False

def main():
    """主函数"""
    # 解析命令行参数
    parser = argparse.ArgumentParser(description="RagFlow 客户端 GUI")
    parser.add_argument("--theme", choices=["auto", "light", "dark"], default="auto",
                      help="界面主题: auto (自动), light (亮色), dark (暗色)")
    args = parser.parse_args()
    
    try:
        # 检查PySide6是否可用
        if not check_pyside6():
            print("错误: 无法导入PySide6库，GUI界面无法启动")
            print("请确保您的Python环境中安装了PySide6")
            print("您可以通过以下命令安装PySide6:")
            print("  uv add PySide6")
            return 1
            
        print("正在启动RagFlow客户端PySide6 GUI...")
        from ragflow_client.gui.pyside_app import run_pyside_gui
        run_pyside_gui()
        return 0
    except Exception as e:
        print(f"启动GUI界面时出错: {str(e)}")
        return 1

if __name__ == "__main__":
    sys.exit(main())
